/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.camachosanchez.gui.table;

import com.camachosanchez.util.Constantes;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author ZULLY
 */
public class RenderizadorTablaBaterias implements TableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        table.getTableHeader().setOpaque(false);
        JLabel etiqueta = new JLabel();
        etiqueta.setOpaque(true);
        etiqueta.setFont(new Font("Arial", Font.PLAIN, 12));
        if (value == null) {
            etiqueta.setText("");
        } else {
            String texto = (String) ("" + value);
            etiqueta.setText(texto.toUpperCase());
        }
        etiqueta.setBackground(Color.white);
        if (column == 0) {
            etiqueta.setBackground(new Color(100, 100, 100));
        }
        if (column == 5) {
            etiqueta.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 5, 1, 1));
            etiqueta.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        } else {
            etiqueta.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        }
        if (isSelected) {
            etiqueta.setBackground(new Color(255, 204, 51));
            if (column == 0) {
                etiqueta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/camachosanchez/recursos/16_check.png")));
            }
        }
        JTableHeader header = table.getTableHeader();
        header.setBackground(Constantes.CABECERA);
        header.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        return etiqueta;
    }
}
